package com.flh.crm.web.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @Author FLH
 * @Date 2020/7/26 12:57
 * @Version 1.0
 */
public class EncodingFilter implements Filter {
    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {

        System.out.println("进入到字符编码控制器");

        //过滤post请求的中文参数乱码
        req.setCharacterEncoding("UTF-8");

        //过滤器响应中文乱码
        resp.setContentType("text/html;charset=utf-8");

        //将请求放行
        chain.doFilter(req,resp);




    }
}
